﻿using System;

namespace Svg.FilterEffects
{
    /// <summary>
    /// A filter effect consists of a series of graphics operations that are applied to a given source graphic to produce a modified graphical result.
    /// </summary>
    [SvgElement("filter")]
    public partial class SvgFilter : SvgElement
    {
        [SvgAttribute("filterUnits")]
        public SvgCoordinateUnits FilterUnits
        {
            get { return GetAttribute("filterUnits", false, SvgCoordinateUnits.ObjectBoundingBox); }
            set { Attributes["filterUnits"] = value; }
        }

        [SvgAttribute("primitiveUnits")]
        public SvgCoordinateUnits PrimitiveUnits
        {
            get { return GetAttribute("primitiveUnits", false, SvgCoordinateUnits.UserSpaceOnUse); }
            set { Attributes["primitiveUnits"] = value; }
        }

        /// <summary>
        /// Gets or sets the position where the left point of the filter.
        /// </summary>
        [SvgAttribute("x")]
        public SvgUnit X
        {
            get { return GetAttribute("x", false, new SvgUnit(SvgUnitType.Percentage, -10f)); }
            set { Attributes["x"] = value; }
        }

        /// <summary>
        /// Gets or sets the position where the top point of the filter.
        /// </summary>
        [SvgAttribute("y")]
        public SvgUnit Y
        {
            get { return GetAttribute("y", false, new SvgUnit(SvgUnitType.Percentage, -10f)); }
            set { Attributes["y"] = value; }
        }

        /// <summary>
        /// Gets or sets the width of the resulting filter graphic.
        /// </summary>
        [SvgAttribute("width")]
        public SvgUnit Width
        {
            get { return GetAttribute("width", false, new SvgUnit(SvgUnitType.Percentage, 120f)); }
            set { Attributes["width"] = value; }
        }

        /// <summary>
        /// Gets or sets the height of the resulting filter graphic.
        /// </summary>
        [SvgAttribute("height")]
        public SvgUnit Height
        {
            get { return GetAttribute("height", false, new SvgUnit(SvgUnitType.Percentage, 120f)); }
            set { Attributes["height"] = value; }
        }

        /// <summary>
        /// Gets or sets reference to another filter element within the current document fragment.
        /// </summary>
        [SvgAttribute("href", SvgAttributeAttribute.XLinkNamespace)]
        public Uri Href
        {
            get { return GetAttribute<Uri>("href", false); }
            set { Attributes["href"] = value; }
        }

        public override SvgElement DeepCopy()
        {
            return DeepCopy<SvgFilter>();
        }
    }
}
